package com.lianxi.pojo.jiaoliu;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * Created by laiyy
 * Date 2018/1/17.
 * <p>
 * 普通模板实体
 * </p>
 * @author laiyy
 */
@Entity
@Table(name = "zw_template")
@ApiModel(value = "template", description = "普通模板实体")
public class Template implements Serializable{

    /**
     *普通模板 id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(name = "id", value = "普通模板 id")
    private int id;

    /**
     * 普通模板名称
     */
    @Column(nullable = false)
    @ApiModelProperty(name = "name", value = "普通模板名称", required = true)
    private String name = "";

    /**
     * 普通模板类型（1：公众交流细览，2：公众交流列表，3：公众交流手机端细览，4：公众交流手机端列表）
     */
    @Column(columnDefinition = "TINYINT DEFAULT 0")
    @ApiModelProperty(name = "type", value = "普通模板类型（1：公众交流细览，2：公众交流列表，3：公众交流手机端细览，4：公众交流手机端列表）", required = true)
    private int type;

    /**
     * 模板状态 （-1：作废，1：正常）
     */
    @Column(columnDefinition = "INT DEFAULT 1")
    @ApiModelProperty(name = "status", value = "模板状态 （-1：作废，1：正常）")
    private int status = 1;

    @Column(name = "create_date")
    @ApiModelProperty(name = "createDate", value = "创建时间")
    private Date createDate;

    @Column(columnDefinition = "INT DEFAULT 0", name = "user_id")
    @ApiModelProperty(name = "userId", value = "模板添加人id", required = true)
    private int userId;

    @Column(nullable = false)
    @ApiModelProperty(name = "username", value = "模板添加人姓名")
    private String username = "";

    @Column( name = "site_id", nullable = false)
    @ApiModelProperty(name = "siteId", value = "模板所属站点id", required = true)
    private String siteId;

    public Template() {
    }

    @Override
    public String toString() {
        return "Template{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", type=" + type +
                ", status=" + status +
                ", createDate=" + createDate +
                ", userId=" + userId +
                ", username='" + username + '\'' +
                ", siteId=" + siteId +
                '}';
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getSiteId() {
        return siteId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Template template = (Template) o;
        return id == template.id &&
                type == template.type &&
                status == template.status &&
                userId == template.userId &&
                Objects.equals(name, template.name) &&
                Objects.equals(createDate, template.createDate) &&
                Objects.equals(username, template.username) &&
                Objects.equals(siteId, template.siteId);
    }

    @Override
    public int hashCode() {

        return Objects.hash(id, name, type, status, createDate, userId, username, siteId);
    }

    public void setSiteId(String siteId) {

        this.siteId = siteId;
    }
}
